<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            <?php echo ($title); ?>
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/task/laybbs/Public/css/x-admin.css" media="all">
        <script src="/task/laybbs/Public/jquery-3.1.1.min.js" charset="utf-8"></script>
        <script src="/task/laybbs/Public/lib/layui/layui.js" charset="utf-8"></script>
        <script src="/task/laybbs/Public/js/x-layui.js" charset="utf-8"></script>
        <script src="/task/laybbs/Public/js/x-admin.js"></script>
    </head>
    <body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header header header-demo">
            <div class="layui-main">
                <a class="logo" href="<?php echo U('admin/index/index');?>">
                    仿LayUI社区后台系统
                </a>
                <ul class="layui-nav" lay-filter="">
                  <li class="layui-nav-item"><img src="/task/laybbs/Public/images/admin_logo.png" class="layui-circle" style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                  <li class="layui-nav-item">
                    <a href="javascript:;"><?php echo $_SESSION['aname']; ?></a>
                    <dl class="layui-nav-child"> <!-- 二级菜单 -->
                      <dd><a href="">个人信息</a></dd>
                      <dd><a href="">切换帐号</a></dd>
                      <dd><a href="javascript:void(0);" id="loginout">退出</a></dd>
                    </dl>
                  </li>
                  <li class="layui-nav-item">
                    <a href="" title="消息">
                        <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                    </a>
                    </li>
                  <li class="layui-nav-item"><a href="<?php echo U('home/index/index');?>">前台首页</a></li>
                </ul>
            </div>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                    <?php foreach ($nav as $nk => $nv) { ?>
                        <li class="layui-nav-item">
                            <a class="javascript:; disable;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;"><?php echo C($nk);?></i><cite><?php echo ($nk); ?></cite>
                            </a>
                            <dl class="layui-nav-child">
                                <?php foreach ($nv as $nvk => $nvv) { ?>
                                    <dd class="">
                                        <dd class="">
                                            <a href="javascript:;" _href="<?php echo U($nvv[0]);?>">
                                                <cite><?php echo ($nvk); ?></cite>
                                            </a>
                                        </dd>
                                    </dd>
                                <?php } ?>
                            </dl>
                        </li>
                    <?php } ?>
                </ul>
            </div>
        </div>
        <div class="layui-tab layui-tab-card site-demo-title" lay-filter="x-tab" lay-allowclose="true">
            <ul class="layui-tab-title">
                <li class="layui-this">
                    我的桌面
                </li>
            </ul>
            <div class="layui-tab-content site-demo site-demo-body">
                <div class="layui-tab-item layui-show">
                    <iframe frameborder="0" src="<?php echo U('admin/index/welcome');?>" class="x-iframe" id="x-iframe"></iframe>
                </div>
            </div>
        </div>
        <div class="site-tree-mobile layui-hide">
            <i class="layui-icon">
                &#xe602;
            </i>
        </div>
        <div class="site-mobile-shade">
        </div>
    </div>
    <script>
    layui.use(['layer'],function(){
        $ = layui.jquery;
        var layer = layui.layer;
        $('#loginout').click(function(){
            layer.confirm('确定退出?', {icon: 3, title:'提示'}, function(index){
                $.ajax({
                    url: '<?php echo U("admin/login/logout");?>',
                    type: 'POST',
                    dataType: 'json',
                })
                .done(function(response) {
                    if (response.info) {
                        layer.msg(response.info, {icon: 6},function () {
                            location.href = "<?php echo U('admin/index/index');?>";
                        });
                    } else {
                        layer.msg('不明原因退出失败', {icon: 5});
                    }
                })
                .fail(function() {
                    console.log("error");
                });
                layer.close(index);
            });
        });
    });
    </script>
</body>
</html>